home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIArray.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  15KB  |  406 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIArray.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIArray_h__
  6. #define __gen_nsIArray_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsISimpleEnumerator; /* forward declaration */
  18.  
  19.  
  20. /* starting interface:    nsIArray */
  21. #define NS_IARRAY_IID_STR "114744d9-c369-456e-b55a-52fe52880d2d"
  22.  
  23. #define NS_IARRAY_IID \
  24.   {0x114744d9, 0xc369, 0x456e, \
  25.     { 0xb5, 0x5a, 0x52, 0xfe, 0x52, 0x88, 0x0d, 0x2d }}
  26.  
  27. /**
  28.  * nsIArray
  29.  *
  30.  * An indexed collection of elements. Provides basic functionality for
  31.  * retrieving elements at a specific position, searching for
  32.  * elements. Indexes are zero-based, such that the last element in the
  33.  * array is stored at the index length-1.
  34.  *
  35.  * For an array which can be modified, see nsIMutableArray below.
  36.  *
  37.  * Neither interface makes any attempt to protect the individual
  38.  * elements from modification. The convention is that the elements of
  39.  * the array should not be modified. Documentation within a specific
  40.  * interface should describe variations from this convention.
  41.  *
  42.  * It is also convention that if an interface provides access to an
  43.  * nsIArray, that the array should not be QueryInterfaced to an
  44.  * nsIMutableArray for modification. If the interface in question had
  45.  * intended the array to be modified, it would have returned an
  46.  * nsIMutableArray!
  47.  *
  48.  * null is a valid entry in the array, and as such any nsISupports
  49.  * parameters may be null, except where noted.
  50.  *
  51.  * @status UNDER_REVIEW
  52.  */
  53. class NS_NO_VTABLE nsIArray : public nsISupports {
  54.  public: 
  55.  
  56.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IARRAY_IID)
  57.  
  58.   /**
  59.      * length
  60.      *
  61.      * number of elements in the array.
  62.      */
  63.   /* readonly attribute unsigned long length; */
  64.   NS_IMETHOD GetLength(PRUint32 *aLength) = 0;
  65.  
  66.   /**
  67.      * queryElementAt()
  68.      *
  69.      * Retrieve a specific element of the array, and QueryInterface it
  70.      * to the specified interface. null is a valid result for
  71.      * this method, but exceptions are thrown in other circumstances
  72.      * 
  73.      * @param index position of element
  74.      * @param uuid the IID of the requested interface
  75.      * @param result the object, QI'd to the requested interface
  76.      *
  77.      * @throws NS_ERROR_NO_INTERFACE when an entry exists at the
  78.      *         specified index, but the requested interface is not
  79.      *         available.
  80.      * @throws NS_ERROR_ILLEGAL_VALUE when index > length-1
  81.      *
  82.      */
  83.   /* void queryElementAt (in unsigned long index, in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
  84.   NS_IMETHOD QueryElementAt(PRUint32 index, const nsIID & uuid, void * *result) = 0;
  85.  
  86.   /**
  87.      * indexOf()
  88.      * 
  89.      * Get the position of a specific element. Note that since null is
  90.      * a valid input, exceptions are used to indicate that an element
  91.      * is not found.
  92.      * 
  93.      * @param startIndex The initial element to search in the array
  94.      *                   To start at the beginning, use 0 as the
  95.      *                   startIndex
  96.      * @param element    The element you are looking for
  97.      * @returns a number >= startIndex which is the position of the
  98.      *          element in the array.
  99.      * @throws NS_ERROR_NOT_FOUND if the element was not in the array.
  100.      */
  101.   /* unsigned long indexOf (in unsigned long startIndex, in nsISupports element); */
  102.   NS_IMETHOD IndexOf(PRUint32 startIndex, nsISupports *element, PRUint32 *_retval) = 0;
  103.  
  104.   /**
  105.      * enumerate the array
  106.      *
  107.      * @returns a new enumerator positioned at the start of the array
  108.      * @throws NS_ERROR_FAILURE if the array is empty (to make it easy
  109.      *         to detect errors)
  110.      */
  111.   /* nsISimpleEnumerator enumerate (); */
  112.   NS_IMETHOD Enumerate(nsISimpleEnumerator **_retval) = 0;
  113.  
  114. };
  115.  
  116. /* Use this macro when declaring classes that implement this interface. */
  117. #define NS_DECL_NSIARRAY \
  118.   NS_IMETHOD GetLength(PRUint32 *aLength); \
  119.   NS_IMETHOD QueryElementAt(PRUint32 index, const nsIID & uuid, void * *result); \
  120.   NS_IMETHOD IndexOf(PRUint32 startIndex, nsISupports *element, PRUint32 *_retval); \
  121.   NS_IMETHOD Enumerate(nsISimpleEnumerator **_retval); 
  122.  
  123. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  124. #define NS_FORWARD_NSIARRAY(_to) \
  125.   NS_IMETHOD GetLength(PRUint32 *aLength) { return _to GetLength(aLength); } \
  126.   NS_IMETHOD QueryElementAt(PRUint32 index, const nsIID & uuid, void * *result) { return _to QueryElementAt(index, uuid, result); } \
  127.   NS_IMETHOD IndexOf(PRUint32 startIndex, nsISupports *element, PRUint32 *_retval) { return _to IndexOf(startIndex, element, _retval); } \
  128.   NS_IMETHOD Enumerate(nsISimpleEnumerator **_retval) { return _to Enumerate(_retval); } 
  129.  
  130. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  131. #define NS_FORWARD_SAFE_NSIARRAY(_to) \
  132.   NS_IMETHOD GetLength(PRUint32 *aLength) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetLength(aLength); } \
  133.   NS_IMETHOD QueryElementAt(PRUint32 index, const nsIID & uuid, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->QueryElementAt(index, uuid, result); } \
  134.   NS_IMETHOD IndexOf(PRUint32 startIndex, nsISupports *element, PRUint32 *_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->IndexOf(startIndex, element, _retval); } \
  135.   NS_IMETHOD Enumerate(nsISimpleEnumerator **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->Enumerate(_retval); } 
  136.  
  137. #if 0
  138. /* Use the code below as a template for the implementation class for this interface. */
  139.  
  140. /* Header file */
  141. class nsArray : public nsIArray
  142. {
  143. public:
  144.   NS_DECL_ISUPPORTS
  145.   NS_DECL_NSIARRAY
  146.  
  147.   nsArray();
  148.  
  149. private:
  150.   ~nsArray();
  151.  
  152. protected:
  153.   /* additional members */
  154. };
  155.  
  156. /* Implementation file */
  157. NS_IMPL_ISUPPORTS1(nsArray, nsIArray)
  158.  
  159. nsArray::nsArray()
  160. {
  161.   /* member initializers and constructor code */
  162. }
  163.  
  164. nsArray::~nsArray()
  165. {
  166.   /* destructor code */
  167. }
  168.  
  169. /* readonly attribute unsigned long length; */
  170. NS_IMETHODIMP nsArray::GetLength(PRUint32 *aLength)
  171. {
  172.     return NS_ERROR_NOT_IMPLEMENTED;
  173. }
  174.  
  175. /* void queryElementAt (in unsigned long index, in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
  176. NS_IMETHODIMP nsArray::QueryElementAt(PRUint32 index, const nsIID & uuid, void * *result)
  177. {
  178.     return NS_ERROR_NOT_IMPLEMENTED;
  179. }
  180.  
  181. /* unsigned long indexOf (in unsigned long startIndex, in nsISupports element); */
  182. NS_IMETHODIMP nsArray::IndexOf(PRUint32 startIndex, nsISupports *element, PRUint32 *_retval)
  183. {
  184.     return NS_ERROR_NOT_IMPLEMENTED;
  185. }
  186.  
  187. /* nsISimpleEnumerator enumerate (); */
  188. NS_IMETHODIMP nsArray::Enumerate(nsISimpleEnumerator **_retval)
  189. {
  190.     return NS_ERROR_NOT_IMPLEMENTED;
  191. }
  192.  
  193. /* End of implementation class template. */
  194. #endif
  195.  
  196.  
  197. /* starting interface:    nsIMutableArray */
  198. #define NS_IMUTABLEARRAY_IID_STR "af059da0-c85b-40ec-af07-ae4bfdc192cc"
  199.  
  200. #define NS_IMUTABLEARRAY_IID \
  201.   {0xaf059da0, 0xc85b, 0x40ec, \
  202.     { 0xaf, 0x07, 0xae, 0x4b, 0xfd, 0xc1, 0x92, 0xcc }}
  203.  
  204. /**
  205.  * nsIMutableArray
  206.  * A separate set of methods that will act on the array. Consumers of
  207.  * nsIArray should not QueryInterface to nsIMutableArray unless they
  208.  * own the array.
  209.  *
  210.  * As above, it is legal to add null elements to the array. Note also
  211.  * that null elements can be created as a side effect of
  212.  * insertElementAt(). Conversely, if insertElementAt() is never used,
  213.  * and null elements are never explicitly added to the array, then it
  214.  * is guaranteed that queryElementAt() will never return a null value.
  215.  *
  216.  * Any of these methods may throw NS_ERROR_OUT_OF_MEMORY when the
  217.  * array must grow to complete the call, but the allocation fails.
  218.  *
  219.  * @status UNDER_REVIEW
  220.  */
  221. class NS_NO_VTABLE nsIMutableArray : public nsIArray {
  222.  public: 
  223.  
  224.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMUTABLEARRAY_IID)
  225.  
  226.   /**
  227.      * appendElement()
  228.      * 
  229.      * Append an element at the end of the array.
  230.      *
  231.      * @param element The element to append.
  232.      * @param weak    Whether or not to store the element using a weak
  233.      *                reference.
  234.      * @throws NS_ERROR_FAILURE when a weak reference is requested,
  235.      *                          but the element does not support
  236.      *                          nsIWeakReference.
  237.      */
  238.   /* void appendElement (in nsISupports element, in boolean weak); */
  239.   NS_IMETHOD AppendElement(nsISupports *element, PRBool weak) = 0;
  240.  
  241.   /**
  242.      * removeElementAt()
  243.      * 
  244.      * Remove an element at a specific position, moving all elements
  245.      * stored at a higher position down one.
  246.      * To remove a specific element, use indexOf() to find the index
  247.      * first, then call removeElementAt().
  248.      *
  249.      * @param index the position of the item
  250.      *
  251.      */
  252.   /* void removeElementAt (in unsigned long index); */
  253.   NS_IMETHOD RemoveElementAt(PRUint32 index) = 0;
  254.  
  255.   /**
  256.      * insertElementAt()
  257.      *
  258.      * Insert an element at the given position, moving the element 
  259.      * currently located in that position, and all elements in higher
  260.      * position, up by one.
  261.      *
  262.      * @param element The element to insert
  263.      * @param index   The position in the array:
  264.      *                If the position is lower than the current length
  265.      *                of the array, the elements at that position and
  266.      *                onwards are bumped one position up.
  267.      *                If the position is equal to the current length
  268.      *                of the array, the new element is appended.
  269.      *                An index lower than 0 or higher than the current
  270.      *                length of the array is invalid and will be ignored.
  271.      *
  272.      * @throws NS_ERROR_FAILURE when a weak reference is requested,
  273.      *                          but the element does not support
  274.      *                          nsIWeakReference.
  275.      */
  276.   /* void insertElementAt (in nsISupports element, in unsigned long index, in boolean weak); */
  277.   NS_IMETHOD InsertElementAt(nsISupports *element, PRUint32 index, PRBool weak) = 0;
  278.  
  279.   /**
  280.      * replaceElementAt()
  281.      *
  282.      * Replace the element at the given position.
  283.      *
  284.      * @param element The new element to insert
  285.      * @param index   The position in the array
  286.      *                If the position is lower than the current length
  287.      *                of the array, an existing element will be replaced.
  288.      *                If the position is equal to the current length
  289.      *                of the array, the new element is appended.
  290.      *                If the position is higher than the current length
  291.      *                of the array, empty elements are appended followed
  292.      *                by the new element at the specified position.
  293.      *                An index lower than 0 is invalid and will be ignored.
  294.      *
  295.      * @param weak    Whether or not to store the new element using a weak
  296.      *                reference.
  297.      *
  298.      * @throws NS_ERROR_FAILURE when a weak reference is requested,
  299.      *                          but the element does not support
  300.      *                          nsIWeakReference.
  301.      */
  302.   /* void replaceElementAt (in nsISupports element, in unsigned long index, in boolean weak); */
  303.   NS_IMETHOD ReplaceElementAt(nsISupports *element, PRUint32 index, PRBool weak) = 0;
  304.  
  305.   /**
  306.      * clear()
  307.      *
  308.      * clear the entire array, releasing all stored objects
  309.      */
  310.   /* void clear (); */
  311.   NS_IMETHOD Clear(void) = 0;
  312.  
  313. };
  314.  
  315. /* Use this macro when declaring classes that implement this interface. */
  316. #define NS_DECL_NSIMUTABLEARRAY \
  317.   NS_IMETHOD AppendElement(nsISupports *element, PRBool weak); \
  318.   NS_IMETHOD RemoveElementAt(PRUint32 index); \
  319.   NS_IMETHOD InsertElementAt(nsISupports *element, PRUint32 index, PRBool weak); \
  320.   NS_IMETHOD ReplaceElementAt(nsISupports *element, PRUint32 index, PRBool weak); \
  321.   NS_IMETHOD Clear(void); 
  322.  
  323. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  324. #define NS_FORWARD_NSIMUTABLEARRAY(_to) \
  325.   NS_IMETHOD AppendElement(nsISupports *element, PRBool weak) { return _to AppendElement(element, weak); } \
  326.   NS_IMETHOD RemoveElementAt(PRUint32 index) { return _to RemoveElementAt(index); } \
  327.   NS_IMETHOD InsertElementAt(nsISupports *element, PRUint32 index, PRBool weak) { return _to InsertElementAt(element, index, weak); } \
  328.   NS_IMETHOD ReplaceElementAt(nsISupports *element, PRUint32 index, PRBool weak) { return _to ReplaceElementAt(element, index, weak); } \
  329.   NS_IMETHOD Clear(void) { return _to Clear(); } 
  330.  
  331. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  332. #define NS_FORWARD_SAFE_NSIMUTABLEARRAY(_to) \
  333.   NS_IMETHOD AppendElement(nsISupports *element, PRBool weak) { return !_to ? NS_ERROR_NULL_POINTER : _to->AppendElement(element, weak); } \
  334.   NS_IMETHOD RemoveElementAt(PRUint32 index) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveElementAt(index); } \
  335.   NS_IMETHOD InsertElementAt(nsISupports *element, PRUint32 index, PRBool weak) { return !_to ? NS_ERROR_NULL_POINTER : _to->InsertElementAt(element, index, weak); } \
  336.   NS_IMETHOD ReplaceElementAt(nsISupports *element, PRUint32 index, PRBool weak) { return !_to ? NS_ERROR_NULL_POINTER : _to->ReplaceElementAt(element, index, weak); } \
  337.   NS_IMETHOD Clear(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Clear(); } 
  338.  
  339. #if 0
  340. /* Use the code below as a template for the implementation class for this interface. */
  341.  
  342. /* Header file */
  343. class nsMutableArray : public nsIMutableArray
  344. {
  345. public:
  346.   NS_DECL_ISUPPORTS
  347.   NS_DECL_NSIMUTABLEARRAY
  348.  
  349.   nsMutableArray();
  350.  
  351. private:
  352.   ~nsMutableArray();
  353.  
  354. protected:
  355.   /* additional members */
  356. };
  357.  
  358. /* Implementation file */
  359. NS_IMPL_ISUPPORTS1(nsMutableArray, nsIMutableArray)
  360.  
  361. nsMutableArray::nsMutableArray()
  362. {
  363.   /* member initializers and constructor code */
  364. }
  365.  
  366. nsMutableArray::~nsMutableArray()
  367. {
  368.   /* destructor code */
  369. }
  370.  
  371. /* void appendElement (in nsISupports element, in boolean weak); */
  372. NS_IMETHODIMP nsMutableArray::AppendElement(nsISupports *element, PRBool weak)
  373. {
  374.     return NS_ERROR_NOT_IMPLEMENTED;
  375. }
  376.  
  377. /* void removeElementAt (in unsigned long index); */
  378. NS_IMETHODIMP nsMutableArray::RemoveElementAt(PRUint32 index)
  379. {
  380.     return NS_ERROR_NOT_IMPLEMENTED;
  381. }
  382.  
  383. /* void insertElementAt (in nsISupports element, in unsigned long index, in boolean weak); */
  384. NS_IMETHODIMP nsMutableArray::InsertElementAt(nsISupports *element, PRUint32 index, PRBool weak)
  385. {
  386.     return NS_ERROR_NOT_IMPLEMENTED;
  387. }
  388.  
  389. /* void replaceElementAt (in nsISupports element, in unsigned long index, in boolean weak); */
  390. NS_IMETHODIMP nsMutableArray::ReplaceElementAt(nsISupports *element, PRUint32 index, PRBool weak)
  391. {
  392.     return NS_ERROR_NOT_IMPLEMENTED;
  393. }
  394.  
  395. /* void clear (); */
  396. NS_IMETHODIMP nsMutableArray::Clear()
  397. {
  398.     return NS_ERROR_NOT_IMPLEMENTED;
  399. }
  400.  
  401. /* End of implementation class template. */
  402. #endif
  403.  
  404.  
  405. #endif /* __gen_nsIArray_h__ */
  406.